import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '项目',
    align: "center",
    dataIndex: 'projectId_dictText'
  },
  {
    title: '简历',
    align: "center",
    sorter: true,
    dataIndex: 'resumeId_dictText'
  },
  {
    title: '面试结果',
    align: "center",
    sorter: true,
    dataIndex: 'resumeInterviewResult_dictText'
  },
  {
    title: '面试官',
    align: "center",
    dataIndex: 'interviewer'
  },
  {
    title: '面试评价',
    align: "center",
    dataIndex: 'resumeEvaluate'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '创建日期',
    align: "center",
    sorter: true,
    dataIndex: 'createTime'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: '更新日期',
    align: "center",
    sorter: true,
    dataIndex: 'updateTime'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "项目",
    field: 'projectId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_project,project_name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "简历",
    field: 'resumeId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tm_resume,real_name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "面试结果",
    field: 'resumeInterviewResult',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "resume_interview_result"
    },
    //colProps: {span: 6},
  },
  {
    label: "面试官",
    field: 'interviewer',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "面试评价",
    field: 'resumeEvaluate',
    component: 'Input',
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '项目',
    field: 'projectId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_project,project_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目!'},
             ];
    },
  },
  {
    label: '简历',
    field: 'resumeId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tm_resume,real_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入简历!'},
             ];
    },
  },
  {
    label: '面试结果',
    field: 'resumeInterviewResult',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "resume_interview_result"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入面试结果!'},
             ];
    },
  },
  {
    label: '面试评价',
    field: 'resumeEvaluate',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入面试评价!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  projectId: {title: '项目',order: 0,view: 'sel_search', type: 'string',dictTable: "tm_project", dictCode: 'id', dictText: 'project_name',},
  resumeId: {title: '简历',order: 1,view: 'list', type: 'string',dictTable: "tm_resume", dictCode: 'id', dictText: 'real_name',},
  resumeInterviewResult: {title: '面试结果',order: 2,view: 'list', type: 'string',dictCode: 'resume_interview_result',},
  interviewer: {title: '面试官',order: 3,view: 'text', type: 'string',},
  resumeEvaluate: {title: '面试评价',order: 4,view: 'textarea', type: 'string',},
  createBy: {title: '创建人',order: 5,view: 'text', type: 'string',},
  createTime: {title: '创建日期',order: 6,view: 'datetime', type: 'string',},
  updateBy: {title: '更新人',order: 7,view: 'text', type: 'string',},
  updateTime: {title: '更新日期',order: 8,view: 'datetime', type: 'string',},
};
